/*
 * Copyright (c) 2017. All  rights reserved.
 * 项目名：microservice-common
 * 文件名：UserMapper.java
 * Date  ：17-11-29 下午12:07
 * Author：abin
 *
 */

package com.microservice.base.mapper.hikcommon;

import com.microservice.base.dto.*;
import com.microservice.base.entity.SysTreeview;
import com.microservice.base.entity.User;
import com.microservice.base.mapper.BaseMP;
import com.microservice.base.vo.UserInformationVo;
import com.microservice.base.vo.searchVo.UserSearchVo;
import com.microservice.base.vo.searchVo.UserTeacsherSearchVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * UserMapper
 *
 * @author dk
 */
public interface UserMapper extends BaseMP<User> {

  User getUserByJoinId(@Param("joinId") String joinId);

  // 保存或修改 student teacher 时 判断icardNo 是否有重复
  int selectBeforeSave(Map<String, Object> map);

  // 登录
  @Override
  List<User> loginUser(User user);

  UserInformationVo getTeacherForLoginName(
      @Param("loginName") String loginName, @Param("schoolCode") String schoolCode);

  User findByLoginName(User user);

  Integer getUserTotalForType(@Param("schoolCode") String schoolCode, @Param("code") String code);

  List<User> queryClassStudent(UserSearchVo userSearchVo);

  Integer getClassStudentCount(UserSearchVo userSearchVo);

  List<User> queryTeachStudent(UserSearchVo userSearchVo);

  Integer getTeachStudenCount(UserSearchVo userSearchVo);

  void deleteByJoinId(String joinId);

  int getLoginName(
      @Param("schoolCode") String schoolCode,
      @Param("id") String id,
      @Param("loginName") String loginName);

  void updateByJoinId(User user);

  List<User> queryCommonTeacher(UserSearchVo userSearchVo);

  Integer getCommonTeacherCount(UserSearchVo userSearchVo);

  List<Map<String, Object>> getLock(String logName);

  void insertLock(List<Map<String, Object>> list);

  void deleteLock();

  List<User> LinkeUserForName(String loginName);

  List<String> queryUserByJoinId(String[] ids);

  List<User> queryUser(String schoolCode);

  void deleteTarea();

  void insertTarea(List<Map<String, Object>> tareaList);

  @Override
  List<User> queryAll();

  void test(String id);

  @Override
  void save(User user);

  @Override
  int update(User user);

  @Override
  void delete(String userId);

  int getUserCountByLoginName(
      @Param("loginName") String loginName, @Param("schoolCode") String schoolCode);

  List<User> getUserByPlaceId(
      @Param("schoolCode") String schoolCode, @Param("placeId") String placeId);

  Map<String, Object> getViewTeacherStudent(String userId);

  List<User> getStudentBySchoolCode(String schoolCode);

  ViewUserStudentTeacherDto getUserByLoginName(String loginName);

  List<ViewUserStudentTeacherDto> getUserByPhone(String phone);

  List<User> getUserByUserType(@Param("userType") String s, @Param("schoolCode") String schoolCode);

  User getUserByCardHex(@Param("schoolCode") String schoolCode, @Param("cardHex") String cardHex);

  User getUserByLoginNameAndSchoolCode(
      @Param("loginName") String loginName,
      @Param("schoolCode") String schoolCode,
      @Param("icardNo") String icardNo);

  void updateBatch(List<User> userList);

  void delUserAvatar(String userId);

  List<UserTeacherDto> getUserTeacherList(UserTeacsherSearchVo userTeacsherSearchVo);

  List<UserSchoolDto> getSchoolAndUserByWxAndUser(
      @Param("loginName") String loginName,
      @Param("schoolCode") String schoolCode,
      @Param("wx") String wx);

  List<UserDto> QueryUser(UserSearchVo userSearchVo);

  int QueryUserCount(UserSearchVo userSearchVo);

  List<StuAndParentDto> getStuAndParentRelation(
      @Param("schoolCode") String schoolCode, @Param("parentPhone") String parentPhone);

  /**
   * 根据userid和tvtype查询用户所属的组织
   *
   * @param tv_type
   * @return
   */
  SysTreeview getTreeByUseIdAndTvtype(@Param("user") User user, @Param("tvType") String tv_type);

  List<User> QueryUserBySyncFlag(String syncFlag);

  void replace(List<User> user);
}
